package companyTest.zhongan;

public class Solution1 {
    public ListNode reverseList (ListNode head) {
        // write code here
        ListNode pre=null;
        while (head.next!=null){
            ListNode temp=head;
            head=head.next;
            temp.next=pre;
            pre=temp;
        }
        head.next=pre;
        return head;
    }
}
